	{template 'common/header'}
<ul class="nav nav-tabs">
    <li {if $operation == 'display' && ($status == '1' || $status == '')} class="active"{/if}>
        <a href="{php echo $this->createWebUrl('showorder', array('op' => 'display', 'status' => 1))}">待审核</a>
    </li>
	<li {if $operation == 'display' && $status == '2'} class="active"{/if}>
        <a href="{php echo $this->createWebUrl('showorder', array('op' => 'display', 'status' => 2))}">已通过</a>
    </li>
	<li {if $operation == 'display' && $status == '3'}class="active"{/if}>
        <a href="{php echo $this->createWebUrl('showorder', array('op' => 'display', 'status' => 3))}">未通过</a>
    </li>
    {if $operation=='edit'}
    <li class="active"> <a>晒单详情</a></li>
    {/if}
</ul>
{if $operation=='display'}
<div class="main">
    <div class="panel panel-info">
	    <div class="panel-heading">筛选</div>
	    <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="weliam_indiana" />
                <input type="hidden" name="do" value="showorder" />
                <input type="hidden" name="status" value="{$status}"/>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">晒单商品</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="可查询商品ID或名称">
                    </div>
                </div>
                
                <div class="form-group">
                        <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">申请时间</label>
                        <div class="col-sm-5 col-lg-7 col-xs-12">
                            {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d', $starttime),'endtime'=>date('Y-m-d', $endtime)),true);}
                        </div>
                        <div class="col-sm-3 col-lg-2" style="text-align:right;"><button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                        </div>
                </div>
                <div class="form-group">
                </div>
            </form>
	    </div>
	</div>

	<div class="panel panel-default">
		<div class="panel-body table-responsive">
			<table class="table table-hover table-bordered">
				<thead class="navbar-inner">
					<tr>
						<th style="width:60px; text-align: center;">商品ID</th>
						<th style="width:160px;text-align: center;">商品名称</th>
						<th style="width:120px;text-align: center;">晒单标题</th>
						<th style="width:270px;text-align: center;">晒单内容</th>
						<th style="width:270px;text-align: center;">附加图</th>
						<th style="width:180px;text-align: center;">申请时间<br>操作</th>
					</tr>
				</thead>
				<tbody style="text-align: center;">
					{loop $list $item}
					<tr>
						<td>{$item['goodsid']}</td>
						<td><textarea   class="form-control description" cols="60">{$item['gtitle']}</textarea></td>
						<td><textarea   class="form-control description" cols="60">{$item['title']}</textarea></td>
						<td><textarea style="height:80px;"  class="form-control description" cols="60">{$item['detail']}</textarea></td>
						<td>{loop $item['thumbs'] $thumb}<image src="{php echo tomedia("..".$thumb);}" style="max-width: 80px; max-height: 80px; border: 1px dotted gray">
							{/loop}
						</td>
						<td >
								{php echo date('Y-m-d H:i', $item['createtime'])}
							<br>
							<label data="{$item['status']}" class="label label-default {if $item['status']==2}label-info{/if}" onclick="setProperty(this,{$item['id']},'2')">通过</label>
							<label data="{$item['status']}" class="label label-default {if $item['status']==3}label-info{/if}" onclick="setProperty(this,{$item['id']},'3')">不通过</label>
							<a href="{php echo $this->createWebUrl('showorder', array('op' => 'edit', 'id' => $item['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="详情/修改"><i class="fa fa-cog fa-spin"></i></a>
							<a href="{php echo $this->createWebUrl('showorder', array('op' => 'delete', 'id' => $item['id']))}" onclick="return confirm('此操作不可恢复，确认删除？');"
								class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times"></i>
							</a>
							
						</td>
					</tr>
					{/loop}
				</tbody>
			</table>
		</div>
	</div>
</div>
{$pager}
<script type="text/javascript">
	require(['daterangepicker'], function($){
		$('.daterange').on('apply.daterangepicker', function(ev, picker) {
			$('#form1')[0].submit();
		});
	});
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
	function setProperty(obj,id,thetype){
		$(obj).html($(obj).html() + "...");
		$.post("{php echo $this->createWebUrl('showorder',array('op'=>'set'))}",{id:id,thetype:thetype},function(d){
				$(obj).html($(obj).html().replace("...",""));
				$(obj).attr("data",d.data);
				if(d.result==1){
					$(obj).toggleClass("label-info").siblings().removeClass('label-info');;
				}
			},"json");
	}
</script>
{elseif $operation=='edit'}
<div class="main">
    <div class="panel panel-info">
	    <div class="panel-heading">晒单详情</div>
	    <div class="panel-body">
            <form class="form-horizontal form" action="" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">晒单标题</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                        <input class="form-control" name="show[title]" id="" type="text" value="{$this_show['title']}" placeholder="可查询商品ID或名称">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">晒单内容</label>
                    <div class="col-sm-8 col-lg-9 col-xs-12">
                       <textarea style="height:100px;"  class="form-control description" cols="60" name="show[detail]">{$this_show['detail']}</textarea>
                    </div>
                </div>
                <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">晒单图片</label>
                <div class="col-sm-9 col-xs-12">
                	{loop $img $m}
                    <img src="{php echo tomedia("..".$m)}" style="width:200px;height:200px;padding:1px;border:1px solid #ccc">
					{/loop}
                </div>
           		 </div>
                <div class="form-group">
                	 <div class="col-sm-3 col-lg-2" style="text-align:right;">
                	 	<button type="submit" class="btn btn-primary span2" name="submit" value="yes"><i class="fa fa-search"></i>确认修改
                	 	</button>
                	 </div>
                </div>
               	    <input type="hidden" name="id" value="{$this_show['id']}" />
					<input type="hidden" name="token" value="{$_W['token']}" />
            </form>
	    </div>
	</div>
</div>
{/if}
{template 'common/footer'}